package com.hjh.pro.annotation1.annotation;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class AnnotationDemo1 {

    @Pointcut("execution(public * com.hjh.pro.annotation1.controller.DemonController.aspect*(..))")
    public void addAdvice(){}

    @Before("addAdvice()")
    public void doBefore(JoinPoint joinPoint){


    }

    @Around("addAdvice()")
    public Object Interceptor(ProceedingJoinPoint pjp){

        Object result = null;
        System.out.println("pjp = [test111]");
        try {

            result =pjp.proceed();

        } catch (Throwable e) {
            e.printStackTrace();
        }
        return result;

    }

}
